import api from '../api/api'
export function getcampus(num) {
  let school_list = [];
  api
    .getListAPI("backup/area/areaTree", {})
    .then((res) => {
      if (res.data.code == 1) {
        var treelist = res.data.data;
        bbq: for (var i = 0; i < treelist.length; i++) {
          ccc: for (var j = 0; j < treelist[i].child.length; j++) {
            ddd: for (
              var z = 0;
              z < treelist[i].child[j].child.length;
              z++
            ) {
              if (treelist[i].areaCode.length == num) {
                school_list.push(treelist[i]);
                break ccc;
                break ddd;
              } else if (treelist[i].child[j].areaCode.length == num) {
                school_list.push(treelist[i].child[j]);
                break ddd;
              } else if (
                treelist[i].child[j].child[z].areaCode.length == num
              ) {
                school_list.push(treelist[i].child[j].child[z]);
              }
            }
          }
        }
      } else {
        ElMessage.error(res.data.message);
      }
    })
    .catch((err) => { });
  return school_list;
}